<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page
	import="org.ejb.entities.*,org.ejb.api.*, javax.naming.*, java.util.*"%>

<%
  UtilisateurInterface serviceRemote=null ;
  String s1,s2,s3,s4,s5,s6,s7,s8,s8_1,s8_2,s8_3,s8_4;
  //,s4,s5,s6,s7,s9,s10;
  // Collection list;
  

  try{
  InitialContext ic = new InitialContext();
  serviceRemote = (UtilisateurInterface) ic.lookup("org.ejb.stateless.UtilisateurStateless@Remote");

  System.out.println("Loaded Utilisateur Bean");

  } catch (Exception ex) {
  System.out.println("Error:"+
  ex.getMessage());
  }

  try {
  	 s1 = request.getParameter("nom");
  	 s2 = request.getParameter("prenom");
	 s3 = request.getParameter("email");
  	 s4 = request.getParameter("password");
     s5 = request.getParameter("gender");
	 s6 = request.getParameter("balance");
	 s7 = request.getParameter("telephone");
	 s8 = request.getParameter("address");
	 s8_1 = request.getParameter("street");
	 s8_2 = request.getParameter("city");
	 s8_3 = request.getParameter("country");
	 s8_4 = request.getParameter("zipcode");
	 
//   s11 = request.getParameter("dateofBirth"); 
//   s9 = request.getParameter("abonnemnt");
//   s10 = request.getParameter("annonce");
  
  if ( s1 != null && s2 != null & s3!= null & s4!= null & s5!= null & s6!= null & s7!= null & s8!= null ) {
	  Integer s6_integer = Integer.parseInt(s6);
	  Utilisateur user = new Utilisateur(s1,s2,s3,s4,s5,s7,s6_integer);
	  Address address = new Address();
	  address.setStreet1(s8_1);
	  address.setCity(s8_2);
	  address.setCountry(s8_3);
	  address.setZipCode(s8_4);
	  serviceRemote.createCustomer(user,address);
	  Integer id = 1;
	  long uid = id.longValue();
	  Utilisateur userfind = serviceRemote.findCustomer(uid);
	  serviceRemote.deleteCustomer(userfind);
	  //serviceRemote.createCustomerString(s1,s2,s3);
	  System.out.println("Record added:");
 %>
  <p>Votre data est bien enregisté!</b></p>
  <%
  }
  
  }// end of try
  catch (Exception e) {
  e.printStackTrace ();
  }
  %>